package com.jt;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import java.util.List;

//标识Controller类 交给Spring容器管理/返回JSON数据
@RestController
@CrossOrigin
//跨域
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 需求: 查询全部用户信息
     * URL: /getAll
     * 返回值: List<User>
     */
    @RequestMapping("/getAll")
    public List<User> getAll(){

        return userService.getAll();
    }
}
